﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using SystemDiagramNew.TypeDefinition;

namespace SystemDiagramNew.SystemDiagramLegend.DataDefine
{
	public class Legend
	{
		public Legend()
		{
			this.Position = XYZ.Zero;
		}

		public Legend(Legend orig)
		{
			this.Position = orig.Position;
			this.m_TextNoteInfoList = orig.TextNoteInfoList;
			this.m_CurveInfoList = orig.CurveInfoList;
			this.m_FillRegionList = orig.FillRegionList;
		}

		public Legend(XYZ position, List<TextNoteInfo> textNoteInfoList, List<CurveInfo> curveInfoList, List<FillRegion> fillRegionList)
		{
			this.Position = position;
			this.m_TextNoteInfoList.Clear();
			this.m_TextNoteInfoList.AddRange(textNoteInfoList);
			this.m_CurveInfoList.Clear();
			this.m_CurveInfoList.AddRange(curveInfoList);
			this.m_FillRegionList.Clear();
			this.m_FillRegionList.AddRange(fillRegionList);
		}

		public XYZ Position { get; set; }

		public List<TextNoteInfo> TextNoteInfoList
		{
			get
			{
				return this.m_TextNoteInfoList;
			}
			set
			{
				this.m_TextNoteInfoList = value;
			}
		}

		public List<CurveInfo> CurveInfoList
		{
			get
			{
				return this.m_CurveInfoList;
			}
			set
			{
				this.m_CurveInfoList = value;
			}
		}

		public List<FillRegion> FillRegionList
		{
			get
			{
				return this.m_FillRegionList;
			}
			set
			{
				this.m_FillRegionList = value;
			}
		}

		public List<CurveInfo> InsertBaseMark()
		{
			List<CurveInfo> list = new List<CurveInfo>();
			double num = 0.5;
			XYZ startPoint = new XYZ(this.Position.X - num, this.Position.Y + num, 0.0);
			XYZ startPoint2 = new XYZ(this.Position.X - num, this.Position.Y - num, 0.0);
			XYZ endPoint = new XYZ(this.Position.X + num, this.Position.Y + num, 0.0);
			XYZ endPoint2 = new XYZ(this.Position.X + num, this.Position.Y - num, 0.0);
			EdgeInfo curve = new EdgeInfo(startPoint2, endPoint, 0.0);
			CurveInfo item = new CurveInfo(curve, PenColor.PC_Red, 1f);
			list.Add(item);
			EdgeInfo curve2 = new EdgeInfo(startPoint, endPoint2, 0.0);
			CurveInfo item2 = new CurveInfo(curve2, PenColor.PC_Red, 1f);
			list.Add(item2);
			return list;
		}

		public void ScalingTransformation(Transform transform)
		{
			this.Position = Geometry.TransformPoint(this.Position, transform);
			foreach (TextNoteInfo textNoteInfo in this.m_TextNoteInfoList)
			{
				textNoteInfo.ScalingTransformation(transform);
			}
			foreach (CurveInfo curveInfo in this.m_CurveInfoList)
			{
				curveInfo.ScalingTransformation(transform);
			}
			foreach (FillRegion fillRegion in this.m_FillRegionList)
			{
				fillRegion.ScalingTransformation(transform);
			}
		}

		private List<CurveInfo> m_CurveInfoList = new List<CurveInfo>();

		private List<FillRegion> m_FillRegionList = new List<FillRegion>();

		private List<TextNoteInfo> m_TextNoteInfoList = new List<TextNoteInfo>();
	}
}
